<template>
  <div class="head-container">
    <!-- 搜索 -->
    <el-input
      v-model="query.modelNo"
      clearable
      placeholder="配件编号"
      style="width: 160px;"
      class="filter-item"
      @keyup.enter.native="toQuery"
    />
    <el-input
      v-model="query.modelName"
      clearable
      placeholder="名称"
      style="width: 160px;"
      class="filter-item"
      @keyup.enter.native="toQuery"
    />
    <el-input
      v-model="query.modelModel"
      clearable
      placeholder="型号"
      style="width: 160px;"
      class="filter-item"
      @keyup.enter.native="toQuery"
    />
    <el-input
      v-model="query.modelSerialno"
      clearable
      placeholder="序列号"
      style="width: 160px;"
      class="filter-item"
      @keyup.enter.native="toQuery"
    />
    <el-button class="filter-item" size="mini" type="success" icon="el-icon-search" @click="toQuery">搜索</el-button>
    <!-- 新增 -->
    <div style="display: inline-block;margin: 0px 2px;">
      <eForm ref="form" :is-add="true" :eqpt-id="eqptId" :is-view="false" :sup-this="supThis" />
    </div>
  </div>
</template>

<script>
import eForm from './form'
import { SPARE_STATES } from '@/constants/consts'
export default {
  components: { eForm },
  props: {
    query: {
      type: Object,
      required: true
    },
    eqptId: {
      type: Number,
      default: -1
    },
    supThis: {
      type: Object,
      required: true
    }
  },
  data() {
    return {
      SPARE_STATES
    }
  },
  methods: {
    toQuery() {
      this.$parent.page = 0
      this.$parent.init()
    },
    newSparepart() {
      this.$refs.form.dialog = true
    }
  }
}
</script>
